﻿using Microsoft.Web.Administration;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;

namespace Wams.Server
{
    public enum SyncType
    {
        Full,
        ContentOnly,
        SettingsOnly
    }

    public class WamsContentSyncTodo
    {
        public List<string> FilesToDownload = new List<string>();
        public List<string> FilesToDelete = new List<string>();
    }

    public class WamsServerBinding
    {
        public string Hostname;
        public int Port;
        public System.Net.IPAddress IP;
        public bool IsHttps = false;
        public string CertificateHash;

        public string BindingInformation
        {
            get
            {
                return string.Format("{0}:{1}:{2}",
                    IP == System.Net.IPAddress.Any ? "*" : IP.ToString(),
                    Port,
                    Hostname);
            }
            set
            {
                string[] parts = value.Trim().Split(new char[] { ':' }, 3);
                if (parts.Length < 3) throw new ApplicationException("Invalid short hand binding: " + value);

                if (parts[0] == "*") IP = System.Net.IPAddress.Any;
                else IP = System.Net.IPAddress.Parse(parts[0]);

                Port = int.Parse(parts[1]);

                Hostname = parts[2];
            }
        }

        public WamsServerBinding() { }
        public WamsServerBinding(string bindingInfo)
        {
            BindingInformation = bindingInfo;
        }
    }


      
}